<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
    <script> 
        //统计输入框字符串的长度
    </script>
</head>

<body>
    <input id="txt" type="text"/>
    <div>字符串长度为： <span id="num">0</span> </div>
    <script>
        $(function(){
            $('#txt').keyup(function(){
               var a = $(this).val().length; 
               console.log(a);
               $('#num').text(a);
            }
            
            )
            
        }

        )
        
        
        
    </script>
</body>

</html>